﻿using NUnit.Framework;
using Moq;
using NHibernate;
using AdventureWorks.DataAccess.Task;
namespace AdventureWorks.DataAccess.Test.task
{
    [TestFixture]
    public class TaskTestBase<TIRepo, TCRepo, TTask> 
        where TIRepo : class
        where TTask : TaskBase<TIRepo, TCRepo>, new()
        where TCRepo : TIRepo, new()
    {
        protected Mock<TIRepo> repositoryMock;
        protected Mock<ISession> sessionMock;
        protected TTask task;
        protected Mock<ISessionFactory> factoryMock;

        [SetUp]
        public void Setup()
        {
            repositoryMock = new Mock<TIRepo>();
            sessionMock = new Mock<ISession>();
            factoryMock = new Mock<ISessionFactory>();
            factoryMock.Setup(x => x.OpenSession()).Returns(sessionMock.Object);
            task = new TTask() { Factory = factoryMock.Object, Repository = repositoryMock.Object };
        }

       [TearDown]
        public virtual void Teardown()
       {

       }


    }
}
